/**
 * @param {string} ransomNote
 * @param {string} magazine
 * @return {boolean}
 */
var canConstruct = function(ransomNote, magazine) {
    
   let strarr = new Array(26).fill(0)
   let base = "a".charCodeAt()
   for(let m of magazine){
       let code = m.charCodeAt()-base
       strarr[code]++
   }
   for(let i = 0;i<ransomNote.length;i++){
        console.log(ransomNote[i],"log")
       let code = ransomNote[i].charCodeAt()-base
       if(!strarr[code]) return false
       strarr[code]--
   }
   return true
};

canConstruct("a","b");